package com.xcity.pomelo.response;

import java.util.List;

import com.xcity.game.common.ItemResponse;
import com.xcity.game.item.ItemTemplate;

import naga.x.App;
import naga.x.game.template.TemplateService;
import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class PVEGetStarBoxResponse extends Response {

	private int page;
	private int type;
	private int index;
	private List<ItemResponse> items;
	private int money;
	private int stone;
	private byte boxState;
	public PVEGetStarBoxResponse(int serial, int page, int type, int index, List<ItemResponse> items, int money, int stone, byte boxstate) {
		super(serial);
		this.page = page;
		this.type = type;
		this.money = money;
		this.stone = stone;
		this.index = index;
		TemplateService ts = App.getApp().getServiceManager().get(TemplateService.class);
		for(int i = 0; i < items.size(); i++){
			ItemResponse item = items.get(i);
			ItemTemplate itemTemp = ts.get(ItemTemplate.class, item.getId());
			if(itemTemp != null){
				item.setName(itemTemp.getName());
				item.setDesc(itemTemp.getDesc());
				item.setIcon(itemTemp.getIcon());
			}
		}
		this.items = items;
		this.boxState = boxstate;
	}
	public int getPage() {
		return page;
	}
	public void setPage(int page) {
		this.page = page;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	public List<ItemResponse> getItems() {
		return items;
	}
	public void setItems(List<ItemResponse> items) {
		this.items = items;
	}
	public int getMoney() {
		return money;
	}
	public void setMoney(int money) {
		this.money = money;
	}
	public int getStone() {
		return stone;
	}
	public void setStone(int stone) {
		this.stone = stone;
	}
	public byte getBoxState() {
		return boxState;
	}
	public void setBoxState(byte boxState) {
		this.boxState = boxState;
	}
}
